package org.sibframework.sda.dbmodel;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Table {
	private String tableName;
	private String pkName;
	private Long numRows;
	private Long avgRowLen;
	private String description;
	private Map<String, Column> columns = new HashMap<String, Column>();
	public String getTableName() {
		return tableName;
	}
	public void setTableName(String tableName) {
		this.tableName = tableName;
	}
	public String getPkName() {
		return pkName;
	}
	public void setPkName(String pkName) {
		this.pkName = pkName;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}

	public void setCloumn(List<Column> columnls) {
		this.columns = new HashMap<String, Column>();
		for (Column col : columnls) {
			columns.put(col.getName(), col);
		}
	}
	
	public void setCloumnMaps(Map<String, Column> cloumns) {
		this.columns = cloumns;
	}
	
	public Collection<Column> getColumns() {
		return this.columns.values();
	}
	
	public String[] getColumnNames() {
		return this.columns.keySet().toArray(new String[0]);
	}
	
	public Column getColumn(String name) {
		return this.columns.get(name);
	}
	public Long getNumRows() {
		return numRows;
	}
	public void setNumRows(Long numRows) {
		this.numRows = numRows;
	}
	public Long getAvgRowLen() {
		return avgRowLen;
	}
	public void setAvgRowLen(Long avgRowLen) {
		this.avgRowLen = avgRowLen;
	}
	
}
